package com.dataart.productshop.service.impl;

import com.dataart.productshop.dao.SubjectDao;
import com.dataart.productshop.model.boiko.informationsystem.Kathedra;
import com.dataart.productshop.model.boiko.informationsystem.Subject;
import com.dataart.productshop.service.SubjectManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("subjectManager")
@Transactional
public class SubjectManagerImpl extends BaseManagerImpl<Subject> implements SubjectManager{

    @Autowired
    public void setSubjectDao(SubjectDao subjectDao){
        this.subjectDao = subjectDao;
        setBaseDao(subjectDao);
    }

    @Override
    public void removeByName(String name){
        subjectDao.removeByName(name);
    }

    @Override
    public List<Subject> getAll(){
        List<Subject> all = super.getAll();
        for (Subject subject : all) {
            subject.getLecturers().size();
            subject.getGpas().size();
        }
        return all;
    }

}
